Skip to content

Preserve Native Auth V2 unified-error diagnostics, Fixes AB#3784695 - #3307

Merged
Silviu Petrescu (spetrescu84) merged 7 commits into
devfrom
djanardhan/native-auth-v2-unified-errors
Oct 19, 2026
Merged

Silviu Petrescu (spetrescu84) merged 7 commits into
devfrom
djanardhan/native-auth-v2-unified-errors

Conversation

@djanardhan98

@djanardhan98 Disha Janardhan (djanardhan98) commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preserve Common diagnostics needed by the shared Android Native Auth V2 error surface, matching AzureAD/microsoft-authentication-library-for-js#8900.

  • Retain suberrors and attribute-validation details in V2 API, interaction, and command results.
  • Forward those diagnostics through V2 controllers and preserve unknown service errors.
  • Use additive, defaulted diagnostic fields and preserve V1 behavior.

Fixes AB#3784695

Dependencies

Consumed by the paired MSAL unified-errors PR: AzureAD/microsoft-authentication-library-for-android#2618.
Authorize-request scopes/claims changes are intentionally excluded.

Validation

Errors-only snapshot: 651 selected unit tests passed (215 MSAL, 346 Common4j, 90 Common Android), with zero failures, errors, or skips in the final XML reports.
The gate includes diagnostic parsing/forwarding and standalone V1 regression coverage.
Final integrated-stack PR2601 validation: 20 live signup/reset E2E tests and 4 recorder tests passed, with 3 known duplicate-account service-test skips. One Mail.tm /accounts HTTP 429 attempt passed on the existing automatic retry; no assertions or retry configuration were changed.
Live validation was executed against the final stacked errors plus scopes/claims sources, not the standalone errors snapshot.

Fixes AB#3784695

Keep raw suberrors and validated attribute details through parser and command results.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784695

Move diagnostic arguments into their authorize/continue/token APIError constructors; preserve errors-only scope behavior. Independently compiled and covered by focused MSAL/Common suites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
@github-actions

Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3784695 to an Azure Boards work item.

@github-actions github-actions Bot changed the title Preserve Native Auth V2 unified-error diagnostics Preserve Native Auth V2 unified-error diagnostics, Fixes AB#3784695 Oct 12, 2026
@github-actions

Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3784695 to an Azure Boards work item.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Controller-level diagnostic propagation lacks local regression coverage.

1 open finding
What changed in this PR

Preserves Native Auth V2 service diagnostics through Common’s parsing and controller layers for the paired MSAL unified-error work.

Changes:

  • Adds suberror and attribute-validation diagnostics to V2 error results.
  • Propagates diagnostics through parsers, controllers, and command results.
  • Adds parser regression coverage for valid and malformed details.
File Description
NativeAuthV2SignUpResponseParserTest.kt Tests diagnostic parsing.
NativeAuthV2ResponseParser.kt Extracts and preserves diagnostics.
NativeAuthV2InteractionApiResult.kt Extends interaction errors.
AuthorizeChallengeApiResult.kt Extends authorization errors.
ApiErrorResult.kt Adds shared validation details.
NativeAuthV2CommandResult.kt Extends sign-up command errors.
INativeAuthCommandResult.kt Extends generic API errors.
NativeAuthV2FlowController.kt Forwards diagnostics through controllers.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Forward trace IDs, timestamps, numeric error codes, and token suberrors through response parsing and V2 command results. Preserve explicit-code precedence and cover typed, generic, and browser fallback mappings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
@djanardhan98 Disha Janardhan (djanardhan98) added the changelog:none No changelog entry or version increment is required. label Oct 15, 2026
Retain service-provided detail messages alongside validation codes and attribute IDs without changing error classification. Cover supported payload shapes and controller forwarding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
@djanardhan98
Disha Janardhan (djanardhan98) marked this pull request as ready for review October 16, 2026 19:21
@spetrescu84
Silviu Petrescu (spetrescu84) merged commit cc25e6e into dev Oct 19, 2026
32 checks passed
Silviu Petrescu (spetrescu84) pushed a commit to AzureAD/microsoft-authentication-library-for-android that referenced this pull request Oct 19, 2026
…2618)

## Summary

Unify Native Auth V2 terminal errors under `NativeAuthErrorV2`, matching
AzureAD/microsoft-authentication-library-for-js#8900.

- Remove the operation-specific V2 error classes without deprecated
compatibility wrappers.
- Expose stable classifiers on the shared error, distinguishing rejected
credentials from new-password policy failures and invalid input.
- Preserve service diagnostics, correlation, exceptions, and recoverable
attribute-validation state.
- Keep Native Auth V1 behavior unchanged.

**Breaking V2 API change:** replace operation-specific error type checks
with `NativeAuthErrorV2` and its classifiers.

Fixes
[AB#3784695](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3784695)

## Dependencies

Requires the paired Common unified-error diagnostics PR:
AzureAD/microsoft-authentication-library-common-for-android#3307.
The Common gitlink points to `3265533f27d8c4054fc5b020ec0228bb872b8344`.
Scopes/claims and OTP-service-validation changes are intentionally
excluded.

## Validation

Errors-only snapshot: **651 selected unit tests passed** (215 MSAL, 346
Common4j, 90 Common Android), with zero failures, errors, or skips in
the final XML reports.
The gate includes shared classifiers, wrong-password versus
invalid-input mappings, diagnostic propagation, and standalone V1
regression coverage.
Final integrated-stack PR2601 validation: **20 live signup/reset E2E
tests and 4 recorder tests passed**, with 3 known duplicate-account
service-test skips. One Mail.tm `/accounts` HTTP 429 attempt passed on
the existing automatic retry; no assertions or retry configuration were
changed.
Live validation was executed against the final stacked errors plus
scopes/claims sources, not the standalone errors snapshot.

The live fixture overlay comes from
#2601 and is not
included in this feature PR.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
Disha Janardhan (djanardhan98) added a commit that referenced this pull request Oct 20, 2026
)

## Summary

Port Common Native Auth V2 authorize-request inputs and related OTP
parity from AzureAD/microsoft-authentication-library-for-js#8898.

- Build on the existing authorize-challenge scope serialization and add
initial claims propagation.
- Include default OIDC scopes for sign-in, sign-up, and reset;
canonicalize only recognized OIDC defaults while preserving resource
scopes.
- Preserve entry scopes for absent continuation inputs and honor
explicitly empty continuation inputs.
- Exclude claims from token serialization while retaining local
metadata; keep scopes on token requests.
- Allow empty OTP values to reach service validation and preserve
existing password-to-email fallback and V1 behavior.

**Approved wire policy:** scopes and optional claims at initial
authorize-challenge, scopes without claims at token exchange, neither on
other intermediate requests. This intentionally follows JS behavior
rather than the work item's literal entry-only scope wording.

Fixes
[AB#3784690](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3784690)

## Dependencies

Stacked on the separate Common unified-errors PR:
#3307. Its
base is the errors branch so the workstream diff stays isolated.
Consumed by the paired MSAL authorize-inputs PR:
AzureAD/microsoft-authentication-library-for-android#2619.
Merge the errors dependency first, then retarget this PR to `dev`.

## Validation

Scopes/claims snapshot: **661 selected unit tests passed** (218 MSAL,
349 Common4j, 94 Common Android), with zero failures, errors, or skips
in the final XML reports.
Coverage includes all three initial entries and token paths, claims wire
encoding, continuation scope retention/override, canonical OIDC defaults
with preserved resource casing/duplicates, empty OTP submission, and
standalone V1 regressions.
Final integrated-stack PR2601 validation: **20 live signup/reset E2E
tests and 4 recorder tests passed**, with 3 known duplicate-account
service-test skips. One Mail.tm `/accounts` HTTP 429 attempt passed on
the existing automatic retry; no assertions or retry configuration were
changed.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Silviu Petrescu <spetrescu@microsoft.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:none No changelog entry or version increment is required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants